import { createRouter, createWebHistory} from 'vue-router'
import configureRouter from './configureRouter'
import Page from '@/Page.vue'
const routes: any = [
  {
    path:'/',
    redirect:'/home',
  },
  {
    path:'/openaccount',
    name: 'openaccount',
    component: () =>import(/* chunkName: "openaccount" */ '@/views/openaccount/index.vue'),
    meta:{
      auth:false,////不登录同样可以访问
      title: {
        zh: "Open an Account",
        en: "Open an Account"
      },
    }
  },
  {
    path:'/',
    component:Page,
    redirect:'/home',
    name:'Page',
    children:[
      {
        path: '/home',
        name:'home',
        component: () =>import(/* webpackChunkName: "home" */ '@/views/home/index.vue'),
        meta: {
          title: {
            zh: "Home",
            en: "home"
          },
          name: 'home'
        }
      },
      {
        path: '/jiaoyi/zhanghu',
        name:'zhanghu',
        component: () =>import(/* webpackChunkName: "jiaoyi" */ '@/views/jiaoyi/zhanghu/index.vue'),
        meta: {
          title: {
            zh: "Trade Account",
            en: "zhanghu"
          },
          name: 'zhanghu'
        }
      },
      {
        path: '/jiaoyi/chanpin',
        name:'chanpin',
        component: () =>import(/* webpackChunkName: "jiaoyi" */ '@/views/jiaoyi/chanpin/index.vue'),
        meta: {
          title: {
            zh: "Trade Products",
            en: "chanpin"
          },
          name: 'chanpin'
        }
      },
      {
        path: '/mt5/desktop',
        name:'desktop',
        component: () =>import(/* webpackChunkName: "mt5" */ '@/views/mt5/index.vue'),
        meta: {
          title: {
            zh: "MT5 Desktop",
            en: "desktop"
          },
          name: 'desktop'
        }
      },
      {
        path: '/mt5/mobile',
        name:'mobile',
        component: () =>import(/* webpackChunkName: "mt5" */ '@/views/mt5/index.vue'),
        meta: {
          title: {
            zh: "MT5 WebTrader",
            en: "mobile"
          },
          name: 'mobile'
        }
      },
      {
        path: '/mt5/webtrader',
        name:'webtrader',
        component: () =>import(/* webpackChunkName: "mt5" */ '@/views/mt5/index.vue'),
        meta: {
          title: {
            zh: "MT5 Mobile",
            en: "webtrader"
          },
          name: 'webtrader'
        }
      },
      {
        path: '/about',
        name: 'about',
        component: () =>import(/* chunkName: "about" */ '@/views/about/index.vue'),
        meta:{
          auth:false,////不登录同样可以访问
          title: {
            zh: "About Us",
            en: "about"
          },
        }
      },
      {
        path: '/news',
        name: 'news',
        component: () =>import(/* chunkName: "news" */ '@/views/news/index.vue'),
        meta:{
          auth:false,////不登录同样可以访问
          title: {
            zh: "NEWS",
            en: "news"
          },
        }
      },
      {
        path: '/news/detail',
        name: 'newsdetail',
        component: () =>import(/* chunkName: "newsdetail" */ '@/views/news/newsdetail/index.vue'),
        meta:{
          auth:false,////不登录同样可以访问
          title: {
            zh: "NEWS",
            en: "newsdetail"
          },
        }
      },
    ]
  },
  {
    path: '/privacypolicy',
    name: 'privacypolicy',
    component: () =>import(/* chunkName: "privacypolicy" */ '@/views/privacypolicy/index.vue'),
    meta:{
      auth:false,////不登录同样可以访问
      title: {
        zh: "Privacy Policy",
        en: "Privacy Policy"
      },
    }
  },
  {
    path: '/login',
    name:'login',
    component: () =>import(/* webpackChunkName: "login" */ '@/views/login/index.vue'),
    meta: {
      title: {
        zh: "Login",
        en: "login"
      },
      name: 'login'
    }
  },
  {
    path: '/404',
    name:'nofound',
    component: () =>import(/* webpackChunkName: "login" */ '@/views/PageNotFound.vue'),
    meta: {
      title: {
        zh: "Not Found",
        en: "nofound"
      },
      name: 'nofound'
    }
  },
  {
    path: '/:pathMatch(.*)*',
    redirect:'/404',
    // name: 'PageNotFound',
    // component: () =>import(/* chunkName: "PageNotFound" */ '@/views/PageNotFound.vue'),
    // meta:{
    //   auth:false,////不登录同样可以访问
    //   title: {
    //     zh: "页面找不到了",
    //     en: "PageNotFound"
    //   },
    // }
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes,
  scrollBehavior() {
    return { left: 0, top: 0 };
  },
})

// Router Hooks
configureRouter(router)

export default router
